﻿<MudText>SelectedItems { @string.Join(", ", _selectedItems) }</MudText>
<MudTable Items="Items"
          T="TableGroupingTest.RacingCar"
          MultiSelection="true"
          SelectOnRowClick="true"
          SelectionChangeable="false"
          @bind-SelectedItems="_selectedItems"
          GroupBy="@_groups"
          GroupHeaderStyle="background-color:var(--mud-palette-background-gray)"
          RowClass="row-click-test"
          OnRowClick="(args) => ++_count">
    <HeaderContent>
        <MudTh>Name</MudTh>
    </HeaderContent>
    <GroupHeaderTemplate>
        <MudTh>@($"{context.GroupName}: {context.Key}")</MudTh>
    </GroupHeaderTemplate>
    <RowTemplate>
        <MudTd>@context.Name</MudTd>
    </RowTemplate>
    <FooterContent>
        <MudTd>F</MudTd>
    </FooterContent>
</MudTable>
<MudText>Clicked: @_count</MudText>

@code {
    public static string __description__ = "The checkboxes should all be disabled on load, even the header, group headers and footer checkboxes.";

    private int _count;
    private HashSet<TableGroupingTest.RacingCar> _selectedItems = [];
    private readonly TableGroupDefinition<TableGroupingTest.RacingCar> _groups = new()
    {
        GroupName = "Category",
        Selector = rc => rc.Category,
        InnerGroup = new TableGroupDefinition<TableGroupingTest.RacingCar>
        {
            GroupName = "Brand",
            Selector = rc => rc.Brand
        }
    };

    public IEnumerable<TableGroupingTest.RacingCar> Items { get; } =
    [
        new("F488", "Ferrari", "GTE"),
        new("919 Hybrid", "Porsche", "LMP1"),
        new("911 RSR", "Porsche", "GTE"),
        new("911 RS", "Porsche", "GT3")
    ];

}
